const CryptoJS = require('crypto-js');
const msg = "card_no=6216610100008898222&client_name=孙思&id_kind=0&id_no=320113196912021509&mobile_tel=13992132300&partner_id=30000001&partner_serial_no=1540537144279&partner_trans_date=20181026&partner_trans_time=145904&pay_bankacct_type=0&sendercomp_id=30000001&targetcomp_id=91000"

// var sHA256 = CryptoJS.SHA256(msg).toString(CryptoJS.enc.Hex);
// console.log("sHA256 = %s", sHA256);

// const forge = require('node-forge');
// var md = forge.md.sha256.create();
// md.update('Message');
// console.log(md.digest().toHex());

// const crypto = require('crypto');
// const fs = require('fs');
// const hash = crypto.createHash('sha256');
// hash.on('readable', () => {
//   const data = hash.read();
//   if (data) {
//     console.log(data.toString('hex'));
//     // Prints:
//     //   6a2da20943931e9834fc12cfe5bb47bbd9ae43489a30726962b576f4e3993e50
//   }
// });

// hash.write('Message');
// hash.end();

const crypto = require('crypto');
// const sign = crypto.createSign('SHA256');
const fs = require('fs');
const pem = require("pem");


const pfx = fs.readFileSync('./40000039.pfx');
pem.readPkcs12(pfx, { p12Password: "xdal4039" }, (err, cert) => {
    console.log(cert.key);
    // sign.write(msg);
    // sign.end();
    // console.log(sign.sign(cert.key,'hex'));
});
  





